<%layout("/common/_layout.html"){ %>
<script type="text/javascript">
var keywordsObj = {};
var submit_btn = function(businessType){

    if($("#name").val())
      keywordsObj.name = $("#name").val();
    if($("#org").val())
      keywordsObj.org_id = $("#org").val();
    if($("#issuance").val())
    keywordsObj.issuance = $("#issuance").val();
    if($("#endTime").val()!="" && $("#endTime").val() < $("#startTime").val()){
    	alert("结束时间不能小于开始时间");
    	return false;
    }
    if($("#startTime").val())
        keywordsObj.start_time = $("#startTime").val();
    if($("#endTime").val())
        keywordsObj.end_time = $("#endTime").val();
    console.log
    
    var keywords = "";
    if(!$.isEmptyObject(keywordsObj)){
      keywords = JSON.stringify(keywordsObj);
    }
    console.log("keywords = "+ keywords);

    $("#keywords").val(keywords);
	if(businessType == "search"){
		$("#list-form").submit();
	}else if(businessType == "export"){
		window.location.href = "${base}/garrison/exportAll?keywords="+keywords;
	}



}

document.onkeydown = function(event){
	if(event.keyCode==13){
		submit_btn('search');
	}
}
</script>

<%#ajax userTable:{%>
<div class="am-cf am-padding">
	<div class="am-fl am-cf">
		<strong class="am-text-primary am-text-lg">报表中心</strong> / <small>驻点录入统计</small>
	</div>
</div>

<div class="am-g">
	<%include("garrison_query.tpl"){}%>
</div>

	<div class="am-g">
		<div class="am-u-sm-12">
			<%if(items.~size > 0){%>
			<div class="am-scrollable-horizontal">
				<table class="am-table am-table-striped am-table-hover table-main" style="TABLE-LAYOUT: fixed">
					<thead>
						<tr class="am-text-nowrap">
							<th class="table-title">地市</th>
							<th class="table-title">驻点服务数量</th>
							<th class="table-title">业务办理总量</th>
							<th class="table-title">4G业务办理量</th>
							<th class="table-title">终端办理量</th>
							<th class="table-title">其他业务办理量</th>
							<th class="table-title">驻点服务集团数量</th>
							<th class="table-title" style="width: 8%;">操作</th>
						</tr>
					</thead>
					<tbody>
						<%for(item in items!){%>
						<tr>
							<td>${item.city}</td>
							<td>${item.garrison_count}</td>
							<td>${item.total_num}</td>
							<td>${item.td_lte_num}</td>
							<td>${item.terminal_num}</td>
							<td>${item.other_business_num}</td>
							<td>${item.group_count}</td>
							<td>
								<a href="${base}/garrison/list?city_id=${item.city_id}">查看详情</a>
							</td>
						</tr>
						<%}%>
					</tbody>
				</table>
			</div>
			<%}%>
			<div class="am-cf">
				<!-- 分页 -->
				<%if (items.~size < 1){%>
				<div class="am-kai">
					<h3>没有找到任何记录!</h3>
				</div>
				<%}%>
			</div>

		</div>
	</div>
	<%}%> <%}%>